﻿#pragma once
#include "AsChartBasics.h"

AS_MEMBER_CLASS_DECLARATION(AsBarChartController);

class AS_GRAPHICS_EXPORT AsBarChartController {
public:
	AsBarChartController(QChartView* chartView);
	AsBarChartController(QChartView* chartView, QChart* chart);
	~AsBarChartController();

private:
	AS_MEMBER_CLASS(AsBarChartController)* m;

public:
	QtCharts::QChartView* chartView();
	QtCharts::QChart* chart();
	void pushTo(QLayout* layout);

public:
	void setAntialiasing(bool b = true);

public:
	void setTitle(const QString& title);
	void setTheme(AsChart::Theme theme);
	void setAnimationOptions(AsChart::AnimationOption option);
	void setLegendVisible(bool visible);

public:
	void barSeries_add(const QString& seriesName);
	void barSeries_delete(const QString& seriesName);
	void barSeries_clear();
	void barSet_add(const QString& seriesName, const QString& barSetName, const QVector<qreal>& values);
	void barSeries_setLabelVisible(bool visible);
	void barSeries_setLabelPosition(AsChart::BarSeriesLabelPosition position);
	void barSeries_setLabelFormat(const QString& format);
	void barSeries_setBarWidth(qreal scale);

public:
	void axis_x_init(const QString& title, const QStringList& barNames);
	void axis_x_delete();
	void axis_x_setTitle(const QString& title);
	void axis_x_setBarNames(const QStringList& barNames);
	void axis_y_init(const QString& title, const QPair<qreal, qreal>& range, int tick_count, bool isVisible_gridLine = true, bool isVisible_line = true);
	void axis_y_delete();
	void axis_y_setTitle(const QString& title);
	void axis_y_setRange(const QVariant& low, const QVariant& up);
	void axis_y_setTickCount(int count, int minor_count = 0);
	void axis_y_setLineVisible(bool visible);
	void axis_y_setGridLineVisible(bool visible);
	void axis_y_setLabelFormat(const QString& format);

public:
	void experiment();

};


